package com.example.demo.controller;/**
 * ClassName: UnavailableController
 * Package: com.example.demo.controller
 * Description:
 *
 * @Author 理理
 * @Create 2025/3/23 19:21
 * @Version 1.0
 */

import com.example.demo.entity.Subscribe;
import com.example.demo.entity.Unavailable;
import com.example.demo.service.UnavailableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Date;
import java.util.List;

/**
 *
 *@title: UnavailableController
 *@Author: Tangerine
 *@Date: 2025/3/23 19:21
 *@version 1.0
 */
@RestController
@RequestMapping("/check")
public class UnavailableController {
    @Autowired
    private UnavailableService unavailableService;

    //查询所有
    @GetMapping("/")
    public List<Unavailable> index(){
        return unavailableService.findAll();
    }

    //查询指定日期不可预约的所有实验室信息
    @GetMapping("/date")
    public List<Unavailable> findDate(@RequestParam Date date){
        return unavailableService.findDate(date);
    }

    //查询指定时间段不可预约的所有实验室信息
    @GetMapping("/time")
    public List<Unavailable> findTime(@RequestParam int time){
        return unavailableService.findTime(time);
    }
}
